import React, { useState } from "react";  
import {login} from "@/services/user/api";
const LoginForm=()=>{
  const [account, setAccount] = useState("");  
  const [password, setPassword] = useState("");  
  const loginFor = ()=>{
    const data={
      'account': account,
      'password':password
    }
    console.log(data);
    login(data).then(res=>{
      if(res.code === 200){
        console.log(res,"dsadadas")
      }
    })
  };
  
  return (  
    <div>  
      <h2>登录</h2>  
      
        <div>  
          <label htmlFor="username">用户名：</label>  
          <input  
            type="text"  
            id="account"  
            value={account}  
            onChange={(e) => setAccount(e.target.value)}  
          />  
        </div>  
        <div>  
          <label htmlFor="password">密码：</label>  
          <input  
            type="password"  
            id="password"  
            value={password}  
            onChange={(e) => setPassword(e.target.value)}  
          />  
        </div>  
        <div>  
          <button type="submit" onClick={()=>loginFor()}>登录</button>{" "}  
        </div>  
 
    </div>  
  );  
  };

export default LoginForm;